package com.blakebarrett.model
{
	import com.blakebarrett.business.VersionService;
	import com.blakebarrett.model.media.MediaInfo;
	import com.blakebarrett.windows.StereoPairWindow;
	
	[Bindable]
	public class Model
	{
		
		public function Model( enforcer : SingletonEnforcer ) {
		}
		
		private static var instance : Model;
		
		public static function getInstance() : Model{
			if ( instance == null ){
				instance = new Model( new SingletonEnforcer() );
			}
			
			return instance;
		}
		
		private var versionService : VersionService = new VersionService();
		
		public var selectedStereoPair : StereoPairWindow;
		
		public function get selectedMediaInfo () : MediaInfo {
			return selectedStereoPair.selectedMedia;
		}
		public function set selectedMediaInfo ( val:MediaInfo ) : void {
			selectedStereoPair.selectedMedia = val;
		}
		
		public function moveImageX ( x : Number ) : void {
			selectedMediaInfo.currentXOffset += x;
		}
		
		public function moveImageY ( y : Number ) : void {
			selectedMediaInfo.currentYOffset += y;
		}
		
		public function scaleImage ( scale : Number ) : void {
			selectedMediaInfo.scale = scale;
		}
		
		public function saveActiveStereogram () : void {
			selectedStereoPair.save();
		}
	}
}

internal class SingletonEnforcer{}